*"* use this source file for the definition and implementation of
*"* local helper classes, interface definitions and type
*"* declarations

CLASS lcl_bom_maintain DEFINITION.
  PUBLIC SECTION.

* Attributes
    DATA lt_bom_head TYPE TABLE FOR CREATE i_billofmaterialtp_2.
    DATA ls_bom_head TYPE i_billofmaterialtp_2.
    DATA lt_billofmaterialitem TYPE TABLE OF i_billofmaterialitemtp_2.
    DATA ls_billofmaterialitem TYPE i_billofmaterialitemtp_2.

    DATA lv_billofmaterialvariant TYPE  i_billofmaterialtp_2-billofmaterialvariant VALUE '01'.
    DATA lv_msg_text TYPE string.


* Methods
    METHODS bom_create
      IMPORTING
                is_data      TYPE ty_json
      RETURNING VALUE(e_msg) TYPE ty_msg.

    " Functional Method
    METHODS  bom_update
      IMPORTING
                is_data      TYPE ty_json
      RETURNING VALUE(e_msg) TYPE ty_msg.

*  PROTECTED SECTION.

*  PRIVATE SECTION.

ENDCLASS.

CLASS lcl_bom_maintain  IMPLEMENTATION.
  METHOD bom_create.

    " Get current date
    DATA(gv_system_date) = cl_abap_context_info=>get_system_date( ).

    " 对LT_billofmaterialitem  进行数据处理
    DATA(lt_child_data) = is_data-childdata.

    DATA lt_user_fields_i TYPE TABLE OF  t_user_fields.
    DATA lv_copy_flag TYPE c.
    DATA lv_repprogp TYPE i_billofmaterialitemtp_2-billofmaterialcomponent.
    DATA lv_billofmaterialitemnumber TYPE i_billofmaterialitemtp_2-billofmaterialitemnumber.
    DATA lv_alternativeitemgroup TYPE i_billofmaterialitemtp_2-alternativeitemgroup..
    CLEAR lv_billofmaterialitemnumber.
    LOOP AT lt_child_data INTO DATA(ls_child_data).

      CLEAR lt_user_fields_i.
      lt_user_fields_i = ls_child_data-userfields.

      LOOP AT lt_user_fields_i INTO DATA(ls_user_fields_i).

        IF ls_user_fields_i-value IS NOT INITIAL.
          CASE ls_user_fields_i-fieldname.
            WHEN 'U_RepProGp'.

              lv_copy_flag = abap_true.
              lv_repprogp = ls_user_fields_i-value.

            WHEN 'U_t'.

              ls_billofmaterialitem-prodorderissuelocation = ls_user_fields_i-value.

          ENDCASE.
        ENDIF.

      ENDLOOP.

      IF lv_billofmaterialitemnumber IS INITIAL.
        lv_billofmaterialitemnumber = '0010'.
      ELSE.
        ADD 10 TO lv_billofmaterialitemnumber .
      ENDIF.

      ls_billofmaterialitem-billofmaterialitemnumber = lv_billofmaterialitemnumber.
      ls_billofmaterialitem-billofmaterialitemcategory = 'L'.
      ls_billofmaterialitem-billofmaterialcomponent = ls_child_data-itemcode.
      ls_billofmaterialitem-billofmaterialitemquantity = ls_child_data-quantity.
      ls_billofmaterialitem-billofmaterialitemunit = ls_child_data-uom.

      IF  lv_copy_flag IS NOT INITIAL.

        IF lv_alternativeitemgroup IS INITIAL.
          lv_alternativeitemgroup = 1.
        ELSE.
          ADD 1 TO lv_alternativeitemgroup.
        ENDIF.

        ls_billofmaterialitem-alternativeitemgroup = lv_alternativeitemgroup.
        ls_billofmaterialitem-usageprobabilitypercent = '100' .
        ls_billofmaterialitem-alternativeitempriority = '1' .
        ls_billofmaterialitem-alternativeitemstrategy = '2' .

        APPEND ls_billofmaterialitem TO lt_billofmaterialitem.
        " RepProGp
        ls_billofmaterialitem-billofmaterialcomponent = lv_repprogp.
        ls_billofmaterialitem-alternativeitemgroup = lv_alternativeitemgroup.
        ls_billofmaterialitem-usageprobabilitypercent = '' .
        ls_billofmaterialitem-alternativeitempriority = '' .
        ls_billofmaterialitem-alternativeitemstrategy = ''.
        APPEND ls_billofmaterialitem TO lt_billofmaterialitem.
      ELSE.

        APPEND ls_billofmaterialitem TO lt_billofmaterialitem.

      ENDIF.

      CLEAR ls_billofmaterialitem.
      CLEAR :lv_copy_flag ,lv_repprogp.

    ENDLOOP.

    " TODO EML
    CLEAR lv_msg_text.
    DATA(lt_userfields_head) = is_data-userfields ." 抬头自定义字段集合

    lt_bom_head = VALUE #( (
                           " %cid = |cid { gv_system_date }|
                            %cid = |cid1|
                            material = is_data-productcode " 'FG126-1'
                            billofmaterialvariant =  lv_billofmaterialvariant " 01 '16'
                            billofmaterialvariantusage =  '1'
                            plant = '1310'                  " '1010'
                            billofmaterialcategory =  'M'
                            headervaliditystartdate  = gv_system_date
                            bomheaderquantityinbaseunit = '1'

                            ) ).

    MODIFY ENTITIES OF i_billofmaterialtp_2
           ENTITY billofmaterial
           CREATE FROM lt_bom_head
           MAPPED DATA(ls_mapped_head)
           FAILED DATA(ls_failed_head)
           REPORTED DATA(ls_reported_head).


    IF  ls_failed_head IS INITIAL  AND ls_mapped_head IS NOT INITIAL.." 表头创建成功

      MODIFY ENTITIES OF i_billofmaterialtp_2
               ENTITY billofmaterial
      CREATE BY \_billofmaterialitem
                  FIELDS (  billofmaterialitemcategory ) WITH VALUE #(
                  (
                          billofmaterial            = ls_mapped_head-billofmaterial[ 1 ]-billofmaterial " '00000209'
                              billofmaterialcategory    = ls_mapped_head-billofmaterial[ 1 ]-billofmaterialcategory " 'M'
                              billofmaterialvariant     = ls_mapped_head-billofmaterial[ 1 ]-billofmaterialvariant " '07'
                              billofmaterialversion     = ''
                              engineeringchangedocument = ''
                              material                  = ls_mapped_head-billofmaterial[ 1 ]-material " 'FG126-1'
                              plant                     = ls_mapped_head-billofmaterial[ 1 ]-plant " '1010'
                            %target = VALUE #(
                     FOR lw_bom_item IN  lt_billofmaterialitem INDEX INTO lv_index_item
                     (

                      %cid = |cid { lv_index_item }|
                      billofmaterialitemnumber = lw_bom_item-billofmaterialitemnumber " '0010'
                      billofmaterialitemcategory = lw_bom_item-billofmaterialitemcategory " 'L'
                      billofmaterialitemquantity = lw_bom_item-billofmaterialitemquantity " '110'
                      billofmaterialitemunit     = lw_bom_item-billofmaterialitemunit " 'ST' " PC
                      billofmaterialcomponent    = lw_bom_item-billofmaterialcomponent " 'SG21'
                      prodorderissuelocation = lw_bom_item-prodorderissuelocation " '131B'
                      alternativeitemgroup = lw_bom_item-alternativeitemgroup "'1'
                      usageprobabilitypercent = lw_bom_item-usageprobabilitypercent " ''
                      alternativeitempriority = lw_bom_item-alternativeitempriority " ''
                      alternativeitemstrategy = lw_bom_item-alternativeitemstrategy " ''
                      isproductionrelevant = 'false'        " 3661954
                     )
                     )
                    )
                    )
                MAPPED DATA(ls_mapped_item)
                FAILED DATA(ls_failed_item)
                REPORTED DATA(ls_reported_item).

      IF  ls_failed_item IS INITIAL AND ls_mapped_item IS NOT INITIAL.

        " 事务提交
        COMMIT ENTITIES BEGIN
                 RESPONSE OF i_billofmaterialtp_2
                   FAILED   DATA(ls_save_failed)
                   REPORTED DATA(ls_save_reported).
        COMMIT ENTITIES END.

        IF  ls_save_failed IS INITIAL.

          lv_msg_text = |新增BOM数据成功：{ is_data-productcode } |.
          e_msg-state = '0'.
          e_msg-errormsg = lv_msg_text.
          e_msg-data =  is_data-productcode.
        ELSE." 事务提交失败

          LOOP AT ls_save_reported-billofmaterial INTO DATA(ls_bom_head_save).
            " 1. 检查%msg是否为空（避免空引用错误）
            IF ls_bom_head_save-%msg IS NOT INITIAL.
              " 2. 调用if_abap_behv_message的方法解析消息文本
              DATA(lo_msg_head) = CAST if_message( ls_bom_head_save-%msg ).

              lv_msg_text = | { lv_msg_text } ';' { lo_msg_head->get_text( ) } |.

            ELSE.

            ENDIF.
          ENDLOOP.

          LOOP AT ls_save_reported-billofmaterialitem INTO DATA(ls_bom_item_save).
            " 1. 检查%msg是否为空（避免空引用错误）
            IF ls_bom_item_save-%msg IS NOT INITIAL.
              " 2. 调用if_abap_behv_message的方法解析消息文本
              DATA(lo_msg_item) = CAST if_message( ls_bom_item_save-%msg ).

              lv_msg_text = | { lv_msg_text } ';' { lo_msg_item->get_text( ) } |.

            ELSE.

            ENDIF.
          ENDLOOP.

        ENDIF.


      ELSE.
        LOOP AT ls_reported_item-billofmaterialitem INTO DATA(ls_bom_item).
          " 1. 检查%msg是否为空（避免空引用错误）
          IF ls_bom_item-%msg IS NOT INITIAL.
            " 2. 调用if_abap_behv_message的方法解析消息文本
            DATA(lo_msg) = CAST if_message( ls_bom_item-%msg ).

            lv_msg_text = | { lv_msg_text } ';' { lo_msg->get_text( ) } |.

          ELSE.
          ENDIF.
        ENDLOOP.

        e_msg-state = '1'.
        e_msg-errormsg = lv_msg_text.
        e_msg-data =  is_data-productcode.
      ENDIF.

    ELSE." 抬头失败错误消息
      LOOP AT ls_reported_head-billofmaterial INTO DATA(ls_bom_head).

        IF ls_bom_head-%msg IS NOT INITIAL.

          DATA(lo_msg_head_c) = CAST if_message( ls_bom_head-%msg ).

          lv_msg_text = |抬头错误信息： { lv_msg_text } ';' { lo_msg_head_c->get_text( ) } |.

**        " 3. 调用if_t100_dyn_msg的方法解析T100消息元数据（如消息类、编号）
*          TRY.
*              " 将%msg转换为T100消息接口（if_t100_dyn_msg）
*              DATA(lo_t100_msg) = CAST if_t100_dyn_msg( ls_bom_item-%msg ).
*
*            CATCH cx_sy_move_cast_error.
*
*          ENDTRY.

        ELSE.
        ENDIF.
      ENDLOOP.
      e_msg-state = '1'.
      e_msg-errormsg = lv_msg_text.
      e_msg-data =  is_data-productcode.

    ENDIF.




  ENDMETHOD.

  METHOD bom_update.
    CLEAR :lv_msg_text.


    " 创建ECN ---BEGIN
    DATA lt_changemaster TYPE TABLE FOR CREATE i_changemastertp_2.
    DATA lv_changenumber TYPE i_changemastertp_2-changenumber.
    DATA(gv_date) = cl_abap_context_info=>get_system_date( ).
    " ADD 10 TO gv_date .":TODO
    DATA: lv_str1(1) TYPE c.
    DATA lv_max_num(11) TYPE n.
    SELECT SINGLE MAX( changenumber ) AS changenumber FROM i_changemastertp_2 WHERE changenumber LIKE 'Z%' INTO  @lv_changenumber.
    lv_str1 = 'Z'.
    IF lv_changenumber IS INITIAL.
      lv_max_num = '00000000000'.
    ELSE.
      lv_max_num = lv_changenumber+1(11).
    ENDIF.

    CONDENSE lv_max_num NO-GAPS. " 去除所有空格
    REPLACE ALL OCCURRENCES OF REGEX '[^0-9]' IN lv_max_num WITH ''. " 清除非数字字符
    ADD 1 TO lv_max_num.

    lv_changenumber = lv_str1 && lv_max_num.

    lt_changemaster = VALUE #( (
    %cid = 'changenumber01'
    changenumber = lv_changenumber
    changenumberstatus = '01'
    changenumberdescription = 'TEST001'
    changenumbervalidfromdate = gv_date
    ) ).


    MODIFY ENTITIES OF i_changemastertp_2
    ENTITY  changemaster
    CREATE FROM lt_changemaster
    CREATE BY \_objtypeassignment
    AUTO FILL CID
    WITH VALUE #( (
                %cid_ref = 'changenumber01'
                %target      = VALUE #( (
                                       sapobjecttype             = 'MaterialBOM'
                                       isactiveforchangenumber   = 'X'
                                         ) )
                    )  )

         MAPPED DATA(mapped)
         REPORTED DATA(reported)
         FAILED DATA(failed).


    IF failed IS INITIAL AND mapped IS NOT INITIAL.
      COMMIT ENTITIES
      RESPONSE OF i_changemastertp_2
          FAILED DATA(failed_commit)
          REPORTED DATA(reported_commit).

      WAIT UP TO 1 SECONDS.

    ELSE." 返回ECN 创建失败消息
      CLEAR  lv_changenumber.
      LOOP AT reported-changemaster INTO DATA(ls_changemaster).
        " 1. 检查%msg是否为空（避免空引用错误）
        IF ls_changemaster-%msg IS NOT INITIAL.

          " 2. 调用if_abap_behv_message的方法解析消息文本
          DATA(lo_msg_changemaster) = CAST if_message( ls_changemaster-%msg ).

          lv_msg_text = | { lv_msg_text } ';' { lo_msg_changemaster->get_text( ) } |.

        ELSE.
        ENDIF.
      ENDLOOP.
      e_msg-state = '1'.
      e_msg-errormsg = | ECN 创建失败 { lv_msg_text  } |.
      e_msg-data =  is_data-productcode.

    ENDIF.

    " 创建ECN ----END

"    SELECT SINGLE MAX( changenumber ) AS changenumber FROM i_changemastertp_2 WHERE changenumber LIKE 'Z%' INTO  @lv_changenumber.

    IF lv_changenumber IS NOT INITIAL.
      SELECT SINGLE * FROM
         i_billofmaterialtp_2
         WHERE material = @is_data-productcode" 'FG126-1'
           AND billofmaterialcategory = 'M'
           AND billofmaterialvariant = @lv_billofmaterialvariant " 01 '16' "  01'
           AND billofmaterialvariantusage = '1'
           AND plant = '1310'
          INTO  @DATA(ls_bom_head)  .


      SELECT * FROM
       i_billofmaterialitemtp_2
       WHERE material = @is_data-productcode"'FG126-1'
         AND billofmaterialcategory = 'M'
         AND billofmaterialvariant = @lv_billofmaterialvariant " 01'16' "  01'
         AND plant = '1310'
         AND chgtoengineeringchgdocument EQ @SPACE
         INTO TABLE @DATA(lt_bom_item)  .


      MODIFY ENTITIES OF i_billofmaterialtp_2
         ENTITY billofmaterialitem
         EXECUTE deletebomitmwthengchangenumber FROM VALUE #(
         FOR lw_bom_item IN lt_bom_item
                         (
                              %key-billofmaterial               = ls_bom_head-billofmaterial " '00057791'
                              %key-billofmaterialcategory       = ls_bom_head-billofmaterialcategory " 'M'
                              %key-material                     = ls_bom_head-material " 'TEST_HEADER_MAT'
                              %key-billofmaterialvariant        = ls_bom_head-billofmaterialvariant "'01'
                              %key-plant                        = ls_bom_head-plant " '0001'
                              %key-headerchangedocument         = ''
                              %key-billofmaterialversion        = ''
                              %key-billofmaterialitemnodenumber = lw_bom_item-billofmaterialitemnodenumber " '00000006'
                              %param-engineeringchangedocforedit = lv_changenumber
                          )  )

                       MAPPED DATA(ls_mapped_d)
                       FAILED DATA(ls_failed_d)
                       REPORTED DATA(ls_reported_d).


      IF  ls_failed_d IS INITIAL ." AND ls_mapped_d IS NOT INITIAL.." 行项目删除成功

        " 对LT_billofmaterialitem  进行数据处理
        DATA(lt_child_data) = is_data-childdata.

        DATA lt_user_fields_i TYPE TABLE OF  t_user_fields.
        DATA lv_copy_flag TYPE c.
        DATA lv_repprogp TYPE i_billofmaterialitemtp_2-billofmaterialcomponent.
        DATA lv_billofmaterialitemnumber TYPE i_billofmaterialitemtp_2-billofmaterialitemnumber.
        DATA lv_alternativeitemgroup TYPE i_billofmaterialitemtp_2-alternativeitemgroup..
        CLEAR lv_billofmaterialitemnumber.
        LOOP AT lt_child_data INTO DATA(ls_child_data).

          CLEAR lt_user_fields_i.
          lt_user_fields_i = ls_child_data-userfields.

          LOOP AT lt_user_fields_i INTO DATA(ls_user_fields_i).

            IF ls_user_fields_i-value IS NOT INITIAL.
              CASE ls_user_fields_i-fieldname.
                WHEN 'U_RepProGp'.

                  lv_copy_flag = abap_true.
                  lv_repprogp = ls_user_fields_i-value.

                WHEN 'U_t'.

                  ls_billofmaterialitem-prodorderissuelocation = ls_user_fields_i-value.

              ENDCASE.
            ENDIF.

          ENDLOOP.

          IF lv_billofmaterialitemnumber IS INITIAL.
            lv_billofmaterialitemnumber = '0010'.
          ELSE.
            ADD 10 TO lv_billofmaterialitemnumber .
          ENDIF.

          ls_billofmaterialitem-billofmaterialitemnumber = lv_billofmaterialitemnumber.
          ls_billofmaterialitem-billofmaterialitemcategory = 'L'.
          ls_billofmaterialitem-billofmaterialcomponent = ls_child_data-itemcode.
          ls_billofmaterialitem-billofmaterialitemquantity = ls_child_data-quantity.
          ls_billofmaterialitem-billofmaterialitemunit = ls_child_data-uom.

          IF  lv_copy_flag IS NOT INITIAL.

            IF lv_alternativeitemgroup IS INITIAL.
              lv_alternativeitemgroup = 1.
            ELSE.
              ADD 1 TO lv_alternativeitemgroup.
            ENDIF.

            ls_billofmaterialitem-alternativeitemgroup = lv_alternativeitemgroup.
            ls_billofmaterialitem-usageprobabilitypercent = '100' .
            ls_billofmaterialitem-alternativeitempriority = '1' .
            ls_billofmaterialitem-alternativeitemstrategy = '2' .

            APPEND ls_billofmaterialitem TO lt_billofmaterialitem.
            " RepProGp
            ls_billofmaterialitem-billofmaterialcomponent = lv_repprogp.
            ls_billofmaterialitem-alternativeitemgroup = lv_alternativeitemgroup.
            ls_billofmaterialitem-usageprobabilitypercent = '' .
            ls_billofmaterialitem-alternativeitempriority = '' .
            ls_billofmaterialitem-alternativeitemstrategy = ''.
            APPEND ls_billofmaterialitem TO lt_billofmaterialitem.
          ELSE.

            APPEND ls_billofmaterialitem TO lt_billofmaterialitem.

          ENDIF.

          CLEAR ls_billofmaterialitem.
          CLEAR :lv_copy_flag ,lv_repprogp.

        ENDLOOP.

        " 创建行项目
        MODIFY ENTITIES OF i_billofmaterialtp_2
                 ENTITY billofmaterial
        CREATE BY \_billofmaterialitem
                    FIELDS (  billofmaterialitemcategory ) WITH VALUE #(
                    (
                            billofmaterial            = ls_bom_head-billofmaterial " '00000209'
                            billofmaterialcategory    = ls_bom_head-billofmaterialcategory " 'M'
                            billofmaterialvariant     = ls_bom_head-billofmaterialvariant " '07'
                            billofmaterialversion     = ''
                            engineeringchangedocument = '' "lv_changenumber
                            material                  = ls_bom_head-material " 'FG126-1'
                            plant                     = ls_bom_head-plant " '1010'
                          %target = VALUE #(
                       FOR lw_bom_item IN  lt_billofmaterialitem INDEX INTO lv_index_item
                       (

                        %cid = |cid { lv_index_item }|
                        billofmaterialitemnumber = lw_bom_item-billofmaterialitemnumber " '0010'
                        billofmaterialitemcategory = lw_bom_item-billofmaterialitemcategory " 'L'
                        billofmaterialitemquantity = lw_bom_item-billofmaterialitemquantity " '110'
                        billofmaterialitemunit     = lw_bom_item-billofmaterialitemunit " 'ST' " PC
                        billofmaterialcomponent    = lw_bom_item-billofmaterialcomponent " 'SG21'
                        prodorderissuelocation = lw_bom_item-prodorderissuelocation " '131B'
                        alternativeitemgroup = lw_bom_item-alternativeitemgroup "'1'
                        usageprobabilitypercent = lw_bom_item-usageprobabilitypercent " ''
                        alternativeitempriority = lw_bom_item-alternativeitempriority " ''
                        alternativeitemstrategy = lw_bom_item-alternativeitemstrategy " ''
                        isproductionrelevant = 'false'      " 3661954
                        engineeringchangedocument =  lv_changenumber
                        engineeringchangedocforedit = lv_changenumber
                        chgtoengineeringchgdocument = lv_changenumber
                       )
                       )
                      )
                      )
                  MAPPED DATA(ls_mapped_item)
                  FAILED DATA(ls_failed_item)
                  REPORTED DATA(ls_reported_item).

        IF  ls_failed_item IS INITIAL AND ls_mapped_item IS NOT INITIAL.

          " 事务提交
          COMMIT ENTITIES BEGIN
                   RESPONSE OF i_billofmaterialtp_2
                     FAILED   DATA(ls_save_failed)
                     REPORTED DATA(ls_save_reported).
          COMMIT ENTITIES END.

          IF  ls_save_failed IS INITIAL.

            lv_msg_text = |变更BOM数据成功：{ is_data-productcode } |.
            e_msg-state = '0'.
            e_msg-errormsg = lv_msg_text.
            e_msg-data =  is_data-productcode.
          ELSE." 事务提交失败

            LOOP AT ls_save_reported-billofmaterial INTO DATA(ls_bom_head_save).
              " 1. 检查%msg是否为空（避免空引用错误）
              IF ls_bom_head_save-%msg IS NOT INITIAL.
                " 2. 调用if_abap_behv_message的方法解析消息文本
                DATA(lo_msg_head) = CAST if_message( ls_bom_head_save-%msg ).

                lv_msg_text = | { lv_msg_text } ';' { lo_msg_head->get_text( ) } |.

              ELSE.

              ENDIF.

            ENDLOOP.

            LOOP AT ls_save_reported-billofmaterialitem INTO DATA(ls_bom_item_save).
              " 1. 检查%msg是否为空（避免空引用错误）
              IF ls_bom_item_save-%msg IS NOT INITIAL.
                " 2. 调用if_abap_behv_message的方法解析消息文本
                DATA(lo_msg_item) = CAST if_message( ls_bom_item_save-%msg ).

                lv_msg_text = | { lv_msg_text } ';' { lo_msg_item->get_text( ) } |.

              ELSE.

              ENDIF.
            ENDLOOP.
            e_msg-state = '1'.
            e_msg-errormsg = lv_msg_text.
            e_msg-data =  is_data-productcode.

          ENDIF.


        ELSE." 返回行项目创建失败消息
          LOOP AT ls_reported_item-billofmaterialitem INTO DATA(ls_bom_item).
            " 1. 检查%msg是否为空（避免空引用错误）
            IF ls_bom_item-%msg IS NOT INITIAL.
              " 2. 调用if_abap_behv_message的方法解析消息文本
              DATA(lo_msg) = CAST if_message( ls_bom_item-%msg ).

              lv_msg_text = | { lv_msg_text } ';' { lo_msg->get_text( ) } |.

            ELSE.
            ENDIF.
          ENDLOOP.

          e_msg-state = '1'.
          e_msg-errormsg = lv_msg_text.
          e_msg-data =  is_data-productcode.
        ENDIF.

      ELSE." 删除失败错误消息
        LOOP AT ls_reported_d-billofmaterial INTO DATA(ls_bom_itme_delete).

          IF ls_bom_itme_delete-%msg IS NOT INITIAL.

            DATA(lo_msg_item_d) = CAST if_message( ls_bom_itme_delete-%msg ).

            lv_msg_text = | { lv_msg_text } ';' { lo_msg_item_d->get_text( ) } |.

          ELSE.
          ENDIF.
        ENDLOOP.
        e_msg-state = '1'.
        e_msg-errormsg = |删除错误信息： { lv_msg_text } |.
        e_msg-data =  is_data-productcode.

      ENDIF.
    ENDIF..

  ENDMETHOD.
ENDCLASS.
